<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品档案修改</title>
    <link rel="stylesheet" href="../../css/pintuer.css">
    <link rel="stylesheet" href="../../css/admin.css">
    <link rel="stylesheet" href="../../css/bootstrap.css">
    <style>
        input{
            border-top: none;
            border-left: none;
            border-right: none;
            border-bottom: black solid 1px;
        }
        table{
            border: 1px;
            cell-padding:0;
            cell-spacing:0;
            width: 80%;
            margin-top: 20px;
        }
        table thead{
            background-color:#b3d7ff ;
        }
        a{
            cursor: pointer;
        }
    </style>
</head>
<body>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/bootstrap-table1.15.3.js"></script>
<script>
    var thisUrl=document.URL;
    var getval=thisUrl.split("?")[1];
    var showval=getval.split("=")[1];
    $(function () {
        $.ajax({
            url:'/dFile/selectByPID.action',
            data: 'id='+showval,
            dataType: 'json',
            type: 'post',
            success:function (data) {
                $("input[name='PRODUCT_NAME']").val(data.PRODUCT_NAME);
                $("input[name='FACTORY_NAME']").val(data.FACTORY_NAME);
                $('input[name="PRODUCT_NICK"]').val(data.PRODUCT_NICK);
                $('input[name="REAL_COST_PRICE"]').val(data.REAL_COST_PRICE);

                $('input[name="FIRST_KIND_ID"]').val(data.FIRST_KIND_NAME);
                $('input[name="SECOND_KIND_ID"]').val(data.SECOND_KIND_NAME);
                $('input[name="THIRD_KIND_ID"]').val(data.THIRD_KIND_NAME);
                $('input[name="PERSONAL_UNIT"]').val(data.PERSONAL_UNIT);
                $('input[name="PERSONAL_VALUE"]').val(data.PERSONAL_VALUE);
                $('input[name="LIST_PRICE"]').val(data.LIST_PRICE);
                $('input[name="COST_PRICE"]').val(data.COST_PRICE);
                $('input[name="WARRANTY"]').val(data.WARRANTY);
                $('input[name="TWIN_NAME"]').val(data.TWIN_NAME);
                $('input[name="TWIN_ID"]').val(data.TWIN_ID);
                $('input[name="LIFECYCLE"]').val(data.LIFECYCLE);
                $('input[name="AMOUNT_UNIT"]').val(data.AMOUNT_UNIT);
                $('textarea[name="PROVIDER_GROUP"]').val(data.PROVIDER_GROUP);
                $('textarea[name="PRODUCT_DESCRIBE"]').val(data.PRODUCT_DESCRIBE);
                $('input[name="REGISTER"]').val(data.REGISTER);
                $('input[name="REGISTER_TIME"]').val(data.REGISTER_TIME);
                $('input[name="TYPE"]').val(data.TYPE==="Y001-1"?"商品":"物料");
                $('select[name="PRODUCT_CLASS"]').val(data.PRODUCT_CLASS);
                $('input[name="CHECK_TAG"]').val(data.CHECK_TAG);
                $('input[name="DELETE_TAG"]').val(data.DELETE_TAG);
                $("input[name='DESIGN_MODULE_TAG']").val(data.DESIGN_MODULE_TAG);
                $('input[name="DESIGN_PROCEDURE_TAG"]').val(data.DESIGN_PROCEDURE_TAG);
                $('input[name="DESIGN_CELL_TAG"]').val(data.DESIGN_CELL_TAG);
                $('input[name="PRODUCT_ID"]').val(data.PRODUCT_ID);
                $('input[name="ID"]').val(data.ID);
                $('input[name="RESPONSIBL_PERSON"]').val(data.RESPONSIBL_PERSON);
                var username = localStorage.getItem("userName");
                $("input[name='CHECKER']").val(username);


                var myDate = new Date;
                var year = myDate.getFullYear(); //获取当前年
                var mon = myDate.getMonth() + 1; //获取当前月
                var date = myDate.getDate(); //获取当前日
                var h = myDate.getHours();//获取当前小时数(0-23)
                var m = myDate.getMinutes();//获取当前分钟数(0-59)
                var s = myDate.getSeconds();//获取当前秒
                $('input[name="CHANGE_TIME"]').val(year+"-"+mon+'-'+date+' '+h+':'+m+':'+s);

            }
        });
        $('#btn_return').click(function () {
            window.location="updSelectProduct.html";
        });

        $('#sub_btn').click(function () {
            var r = window.confirm("请问您是否要修改该产品");
            if(r){
                var frm = $('#frm').serialize();
                frm = decodeURIComponent(frm,true);
                $.ajax({
                    url:'/dFile/updProduct.action',
                    type:'post',
                    data:frm,
                    success:function (data) {
                        if(data>0){
                            window.location="updSelectProduct.html";
                        }
                    }
                })
            }
        });

    })



</script>
<div class="container">

    <div style="background-color: lightgray;width: 100%; margin-top: 0px;padding-top: 0px;">
    </div>
    <div style="width: 90%;position: absolute;left: 50px;">
        <div class="row" style="height: 20% ;">
            <div class="col-8"></div>
            <div class="col-2" >
                <button class="btn" id="sub_btn" style="background-color: cornflowerblue">提交</button>
            </div>
            <div class="col-2" >
                <button class="btn btn-warning" id="btn_return" style="margin-right: -20px">返回</button>
            </div>
        </div>
        <form id="frm">
            <input type="hidden" name="ID">
            <table  class="table">
                <tr>
                    <td colspan="4"><div style="margin: 0px;padding: 0px; background-color: #09c"><span style="color: #eeffff">主信息</span></div></td>
                </tr>
                <tr>
                    <td><span style="color: black;">档案编号</span></td>
                    <td><input type="text" name="PRODUCT_ID" readonly="readonly"></td>
                </tr>
                <tr>
                    <td><span style="color: black;">产品名称：</span></td>
                    <td><input type="text" name="PRODUCT_NAME" readonly="readonly"></td>
                    <td><span style="color: black;">制造商：</span></td>
                    <td><input type="text" name="FACTORY_NAME"></td>
                </tr>
                <tr>
                    <td><span style="color: black;">I级分类：</span></td>
                    <td><input name="FIRST_KIND_ID" readonly="readonly"></td>
                    <td><span style="color: black;">II级分类：</span></td>
                    <td><input readonly="readonly" name="SECOND_KIND_ID"></td>
                </tr>

                <tr>
                    <td><span style="color: black;">III级分类：</span></td>
                    <td><input readonly="readonly" name="THIRD_KIND_ID"></td>
                    <td><span style="color: black;">产品简称：</span></td>
                    <td><input type="text" name="PRODUCT_NICK"/></td>
                </tr>

                <tr>
                    <td><span style="color: black;">用途类型：</span></td>
                    <td><input  type="text" name="TYPE" readonly="readonly"></td>
                    <td><span style="color: black;">档次级别：</span></td>
                    <td><select name="PRODUCT_CLASS">
                        <option>--------------------------</option>
                        <option value="D001-1">高档</option>
                        <option value="D001-2">中档</option>
                        <option value="D001-3">低档</option>
                    </select></td>
                </tr>
                <tr>
                    <td><span style="color: black;">计量单位：</span></td>
                    <td><input type="text" name="PERSONAL_UNIT"></td>
                    <td><span style="color: black;">计量值：</span></td>
                    <td><input type="text" name="PERSONAL_VALUE"></td>
                </tr>
                <tr>
                    <td><span style="color: black;">市场单价（元）：</span></td>
                    <td><input type="text" readonly="readonly" name="LIST_PRICE"></td>
                    <td><span style="color: black;">计划成本单价（元）：</span></td>
                    <td><input type="text" readonly="readonly" name="COST_PRICE"></td>
                </tr>
                <tr>
                    <td><span style="color: black">成本单价</span></td>
                    <td><input type="text" readonly="readonly" name="REAL_COST_PRICE"></td>
                </tr>
                <tr>
                    <td colspan="4"><div style="margin: 0px;padding: 0px; background-color: #09c"><span style="color: #eeffff">辅助信息</span></div></td>
                </tr>
                <tr>
                    <td><span style="color: black;">保修期：</span></td>
                    <td><input type="text" name="WARRANTY"></td>
                    <td><span style="color: black;">替代品名称：</span></td>
                    <td><input type="text" name="TWIN_NAME"></td>
                </tr>
                <tr>
                    <td><span style="color: black;">替代品编号：</span></td>
                    <td><input type="text" name="TWIN_ID"></td>
                    <td><span style="color: black;">生命周期（年）：</span></td>
                    <td><input type="text" name="LIFECYCLE"></td>
                </tr>
                <tr>
                    <td><span style="color: black;">单位：</span></td>
                    <td><input type="text" name="AMOUNT_UNIT"></td>
                    <td><span style="color: black;">产品经理：</span></td>
                    <td><input name="RESPONSIBL_PERSON"></td>
                </tr>
                <tr>
                    <td><span style="color: black;">供应商集合：</span></td>
                    <td><textarea  name="PROVIDER_GROUP"></textarea></td>
                    <td><span style="color: black;">产品描述：</span></td>
                    <td><textarea  name="PRODUCT_DESCRIBE"></textarea></td>
                </tr>
                <tr>
                    <td><span style="color: black;">变更时间：</span></td>
                    <td><input name="CHANGE_TIME"/></td>
                </tr>
            </table>
        </form>
    </div>

</div>
</body>
</html>